home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
pubdom.tar
/
pubdom
/
rbj
/
mphase
< prev
next >
Wrap
Text File
|
1990-05-30
|
3KB
|
58 lines
%%HP: T(3)A(D)F(.);
@ MPHASE - Moon Phase: Put date on stack, MPHASE
@ WJQ 5/27/90
@ RBJ 5/29/90, Notes: Origin at Upper Left, X to Right, Y Downward
@ 5/30/90 Circle Radius 26, Origin (64,28)
@
\<< @ Start of MPHASE
\<< @ Start Local Function "p"
@ Radius, Ycoord, MoonFrac
\<< @ Start Function "h" within "p"
\-> rfrac yc rl rr @ Rad frac, Y, Rleft, Rright
\<< @ Center at X = 64 pixels
rfrac rl * 64 + R\->B yc R\->B @ Start (rfrac*rl+64, yc)
2 \->LIST @ Convert to pixel list
rfrac rr * 64 + R\->B yc R\->B @ End (rfrac*rr+64, yc)
2 \->LIST @ Convert to pixel list
LINE @ Draw Line
\>>
\>> @ End of Function "h"
\-> rad yc mfrc h @ Guts of "p": rad, y, frac, "h"
\<<
IF mfrc .5 < @ Test Moon Fraction
THEN mfrc 360 * COS rad * @ Left radius
rad @ Right Pixel
ELSE rad NEG @ Same if test false
mfrc .5 - 360 * COS rad * @
END
\-> l r @ Grab Left, Right Radii
\<< 1 0 @ x: fraction of Radius
FOR x @ Loop from 1.00 to 0.000
x ACOS SIN DUP @ Moon Radius at "Latitude"
yc x rad * + l r h EVAL @ Lower Line
yc x rad * - l r h EVAL @ Upper Line
rad INV NEG @ Decrement x by (1/rad)
STEP
\>> @ End of prgm with local l, r
\>> @ End of functional part of "p"
\>> @ End of local function "p"
\-> d p @ Store date & local function "p"
@ MAIN Program
\<< -31 SF ERASE @ Clear graphic screen
{ #0d #0d } PVIEW @ Circle at (64,28), R = 26
{ #64d #28d } #26d 0 360 ARC @ Point, Radius, Angles ARC
26 28 @ Radius, Y coord (Used by p EVAL)
1.121975 d DDAYS @ Days since Jan 12, 1975
.8 + @ Add .8 days (7:20 PM ?)
1440 * @ Convert to minutes
42532 / FP @ Find fraction of period (orbit)
p EVAL @ Run the local function above
PICT PICT RCL NEG @ Invert Graphics
{ #0d #0d } SWAP REPL
7 FREEZE @ Hold Screen
d @ Put date back on stack
\>>
\>>